<?php

    require ( 'init.inc.php' );
    require ( 'checkadmin.inc.php');
    require ( __COMM_PATH . 'pagecontrol.inc.php' );
    require ( __COMM_PATH . 'checkform.func.php' );
    require ( __CLASS_PATH . 'page_edit.class.php' );

    // -------------------------------------------------------
    // 接收传递过来的变量
    // -------------------------------------------------------
    $action = $_REQUEST["action"];
    $id     = addslashes($_REQUEST["id"]);

    // -------------------------------------------------------
    // 页面基本设置
    // -------------------------------------------------------
    $page_title   = $ptitle["job_edit"];
    $page_type    = "edit";
    $display_page = "job_edit.htm";
    $table_name   = "{$tablepre}jobs";
    $condition    = "WHERE `id`='{$id}'";
    $back_page    = "job_list.php?sortby={$_GET['sortby']}&oexp={$_GET['oexp']}&page={$_GET['page']}&keyword={$_GET['keyword']}";

    // -------------------------------------------------------
    // 保存编辑数据
    // -------------------------------------------------------
    if ($action=="submit") {
        $jobs = dhtmlspecialchars(check_empty($_POST["jobs"],$clang[job_list]));
        $fields_arr = array(
            "jobs" => dhtmlspecialchars($_POST["jobs"]),
            "number" => intval($_POST["number"]),
            "place" => dhtmlspecialchars($_POST["place"]),
            "salary" => dhtmlspecialchars($_POST["salary"]),
            "expires" => $_POST["expires"],
            "posttime" => date("Y-m-d H:i:s", strtotime($_POST["posttime"])),
            "resbility" => dhtmlspecialchars($_POST["resbility"]),
            "require" => dhtmlspecialchars($_POST["require"]),
            "status" => intval($_POST["status"]),
        );
    }

    // -------------------------------------------------------
    // 执行页面处理
    // -------------------------------------------------------
    show_page_head($page_type, $page_title);
    $pedit = new PageEdit($page_title, $back_page, $page_type);
    $pedit->SetParam($table_name, $condition);
    $pedit->UpdateData($fields_arr);
    $pedit->TplParse($display_page);
    show_page_foot();
    $db->close();
?>